Skip to content

#51 Add payment functionality#54

Merged
martti007 merged 5 commits intoissue-52from
issue-51
Apr 14, 2026
Merged

#51 Add payment functionality#54
martti007 merged 5 commits intoissue-52from
issue-51

Conversation

@martti007
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a payment model on top of tokens, including support for splitting token-embedded payment assets into multiple “child” tokens backed by Merkle proofs and a burn transaction.

Changes:

  • Adds new payment domain types (PaymentData, Asset, TokenSplit, split proofs/results) and related CBOR encoding/decoding hooks.
  • Introduces a built-in BURN predicate and a generic UnlockScript interface to support passing typed unlock scripts into certification.
  • Adds functional tests and updates test utilities to mint/transfer tokens with custom data payloads.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/test/java/org/unicitylabs/sdk/utils/TokenUtils.java Adds overloads to mint tokens with custom data and to transfer using a prebuilt TransferTransaction.
src/test/java/org/unicitylabs/sdk/functional/payment/TestSplitPaymentData.java Test-only SplitPaymentData implementation with CBOR encoding/decoding.
src/test/java/org/unicitylabs/sdk/functional/payment/TestPaymentData.java Test-only PaymentData implementation with CBOR encoding/decoding.
src/test/java/org/unicitylabs/sdk/functional/payment/SplitBuilderTest.java Functional test covering mint + split + burn + re-mint split tokens + verification.
src/main/java/org/unicitylabs/sdk/transaction/Token.java Exposes the genesis transaction via getGenesis() for payment/split logic.
src/main/java/org/unicitylabs/sdk/predicate/builtin/PayToPublicKeyPredicateUnlockScript.java Implements the new UnlockScript interface.
src/main/java/org/unicitylabs/sdk/predicate/builtin/PayToPublicKeyPredicate.java Removes redundant built-in predicate boilerplate in favor of BuiltInPredicate defaults.
src/main/java/org/unicitylabs/sdk/predicate/builtin/BurnPredicate.java Adds new built-in predicate type used to “burn” a token to an aggregation-root reason.
src/main/java/org/unicitylabs/sdk/predicate/builtin/BuiltInPredicateType.java Adds BURN(3) to the built-in predicate type registry.
src/main/java/org/unicitylabs/sdk/predicate/builtin/BuiltInPredicate.java Adds default getEngine() and encodeCode() for built-in predicates.
src/main/java/org/unicitylabs/sdk/predicate/UnlockScript.java Introduces a typed unlock-script interface (encode()).
src/main/java/org/unicitylabs/sdk/predicate/PredicateEngine.java Encapsulates id (now private) and exposes getId().
src/main/java/org/unicitylabs/sdk/payment/asset/AssetId.java Adds AssetId value type with CBOR + bitstring conversion.
src/main/java/org/unicitylabs/sdk/payment/asset/Asset.java Adds Asset value type with CBOR encoding/decoding.
src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java Implements split construction and split-reason verification via Merkle proofs + burn predicate.
src/main/java/org/unicitylabs/sdk/payment/SplitResult.java Holds the burn transaction plus per-split-token proofs.
src/main/java/org/unicitylabs/sdk/payment/SplitReasonProof.java Proof container: aggregation-path + asset-tree-path for an AssetId.
src/main/java/org/unicitylabs/sdk/payment/SplitReason.java Encodes/decodes the burn token and its proofs as a reason for a split token.
src/main/java/org/unicitylabs/sdk/payment/SplitPaymentDataDeserializer.java Functional interface for decoding SplitPaymentData.
src/main/java/org/unicitylabs/sdk/payment/SplitPaymentData.java Payment data interface extension including a SplitReason.
src/main/java/org/unicitylabs/sdk/payment/PaymentDataDeserializer.java Functional interface for decoding PaymentData.
src/main/java/org/unicitylabs/sdk/payment/PaymentData.java Base interface for payment-carrying token data.
src/main/java/org/unicitylabs/sdk/api/CertificationData.java Adds overload fromTransaction(Transaction, UnlockScript) for typed unlock scripts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java
Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java
Comment thread src/main/java/org/unicitylabs/sdk/payment/asset/Asset.java Outdated
Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java
Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java Outdated
Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java
Comment thread src/main/java/org/unicitylabs/sdk/payment/SplitResult.java Outdated
Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java Outdated
Copy link
Copy Markdown
Member

@MastaP MastaP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of the payment/split functionality. Skipping issues already raised by Copilot (unused import, duplicate AssetId handling, line length, Asset constructor validation, leaf data verification).

Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java
Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java Outdated
Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java
Comment thread src/main/java/org/unicitylabs/sdk/payment/SplitReasonProof.java
Comment thread src/main/java/org/unicitylabs/sdk/payment/SplitReason.java Outdated
Comment thread src/main/java/org/unicitylabs/sdk/payment/TokenSplit.java
Comment thread src/main/java/org/unicitylabs/sdk/predicate/PredicateEngine.java
@martti007 martti007 requested a review from MastaP April 6, 2026 19:49
@MastaP MastaP linked an issue Apr 13, 2026 that may be closed by this pull request
@martti007 martti007 merged commit 5463ca1 into issue-52 Apr 14, 2026
1 check passed
@martti007 martti007 deleted the issue-51 branch April 14, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TGE] V2 Support payments and splits (Java SDK)

3 participants